${page.setTitle("医付通 | GOPS").addScript("epay-enums.js")}
<div class="body-pla-content">
	<div style="padding-bottom: 5px;">
		<form>
		<table class="l-table-edit">
			<tr>
	               <td  class="td-name"> 调用URL：</td>
				   <td>
				   		<input type="text" name="invokeUrl" ltype="text" id="invokeUrl" style="width: 130px">
				   </td>
				   <td  class="td-name"> 传输URL：</td>
				   <td>
				   		<input type="text" name="shipUrl" ltype="text" id="shipUrl">
				   </td>
			
				    <td class="td-name">开始日期：</td>
				   <td><input name="startDate" type="text" id="startDate"/></td>
				   <td class="td-name">结束日期：</td>
				   <td><input name="endDate" type="text" id="endDate" /></td>
			   </tr>
			   <tr>
				   <td class="td-name">传输类型：</td>
				   <td>
				   		<select name="shipperType" id="shipperType" style="width:133px">
							<option value=''>全部</option>
							<#list shipperTypeList as enum>
									<option value="${enum.value}">${enum.value}</option>
							</#list>
						</select>
				   </td>
				   <td class="td-name">回调类型：</td>
				   <td>
				   		<select name="callbackType" id="callbackType" style="width:133px">
							<option value=''>全部</option>
							<#list callbackTypeList as enum>
									<option value="${enum.value}">${enum.value}</option>
							</#list>
						</select>
				   </td>
				  	    <td  class="td-name"> 是否同步：</td>
				   <td>
				   		<select name="issyn" id="issyn" style="width:133px">
							<option value=''>全部</option>
							<option value='0'>同步</option>
							<option value='1'>异步</option>
						</select>
				   </td>
				    <td  class="td-name"> 调用类型：</td>
				   <td>
				   		<select name="invokeType" id="invokeType"  style="width:133px">
							<option value=''>全部</option>
							<#list invokerTypeList as enum>
									<option value="${enum.value}">${enum.value}</option>
							</#list>
						</select>
				   		<input type="button" value="查询" onclick="f_search()" class="l-button"/> 
				   		<input type="reset" value="清空" class="l-button"/> 
				   		<!--
				   		<input type="reset" value="删除选中"  onclick="f_deleteBatch()"  class="l-button"/> 
				   		-->
				   </td>
				   <td>
				   		
				   </td>
			   </tr>
			      <tr>
			   		  <td  class="td-name"> 前置机ID：</td>
				   <td>
				   		<input type="text" name="frontId" ltype="text" id="frontId">
				   </td>
			   		  <td  class="td-name"> 接口名：</td>
				   <td>
				   		<input type="text" name="name" ltype="text" id="name">
				   </td>
			   </tr>
	        </table>
	        </form>
        </div>
		<div id="maingrid4" style="margin:0; padding:0"></div>
</div>
<script type="text/javascript">
 	  var grid = null;
      $(function () {
       var hasError; 
       var params;
       grid = $("#maingrid4").ligerGrid({
              columns: [
              { display: 'ID', name: 'id', width: 50},
              { display: '前置机ID', name: 'frontId', width: 50},
              { display: '接口名',width:130,
              	render:function(item){
              	 	return "<a title='"+item.name+"'>"+item.name+"</a>";
              	}
              },
              { display: '调用类型', name: 'invokeType', width: 60},
              { display: '传输类型', name: 'shipperType', width: 60},
              { display: '回调类型', name: 'callbackType', width: 60},
              { display: '描述', minWidth: 40, 
              	render:function(item){
              	 	return "<a title='"+item.remark+"'>"+item.remark+"</a>";
              	}
              	},
              { display: '是否同步', width: 40,
              	render:function(item){
              		if(item.issyn==0){
              			return "同步";
              		}else if(item.issyn==1){
              			return "异步";
              		}
              	}
              },
             
              { display: '操作',  width: 140, render: function (rowdata, rowindex){
                      var h = "<a href=javascript:f_open("+$.ligerui.toJSON(rowdata.id)+")>修改&nbsp;&nbsp;|</a>";
                      h +=  "<a href=javascript:f_delete("+$.ligerui.toJSON(rowdata.id)+")>&nbsp;&nbsp删除</a>";
                      return h;
                  }
              }
              ],
              pageSize:20,
              width: '100%',height:'100%',
              url:'${centerServer}/interface/record-data',
              delayLoad : true,
              rownumbers:true,
              //checkbox:true,
              method:'get',
              enabledSort:false,
              onSuccess :function(data, grid){
            	  params=data.paramsMap;
            	  hasError=data.hasError;
            	  if(data.hasError){
            		  $.ligerDialog.error(data.message);
            	  }
              },
              onAfterShowData:function(data){
            	  if(!hasError){
	            	  $("span.pcontrol").find("input").val(params.page);
	            	  $(".l-panel-bbar-inner .l-bar-text").html("显示从"+params.startPos+"到"+params.endPos+"|总"+data.Total+"条|每页显示"+params.pagesize);
            	  }
            	  if(params){
            		  $("#startDate").val(params.startDate);
	            	  $("#endDate").val(params.endDate);
            	  }
              }
          });
          $("#pageloading").hide();
          
           $("#startDate").ligerDateEditor({
              format: "yyyy-MM-dd",
              labelWidth: 100,
              labelAlign: 'right'
           });
       	 $("#endDate").ligerDateEditor({
             format: "yyyy-MM-dd",
             labelWidth: 100,
             labelAlign: 'right'
          });
      });
       
       /**
       * @desc 根据条件查询账户信息
       * @author li.zhao
       */
       function f_search() {
        	 grid.setOptions( {
	                 parms : [ { name : 'startDate',value : $("#startDate").val()},
	                           { name : 'endDate',value : $("#endDate").val()} ,
	                 		   { name : 'invokeUrl',value : $("#invokeUrl").val()},
	                           { name : 'shipUrl',value : $("#shipUrl").val()} ,
	                 		   { name : 'shipperType',value : $("#shipperType").val()} ,
	                 		   { name : 'callbackType',value : $("#callbackType").val()},
	                 		   { name : 'issyn',value : $("#issyn").val()}, 
	                 		   { name : 'frontId',value : $("#frontId").val()},
	                 		   { name : 'invokeType',value : $("#invokeType").val()},
	                 		   { name : 'name',value : $("#name").val()} 
	                 		 ]
	         });
	      
      		grid.loadData();
       }
       //页面初始载入的时候加载
       $(function(){
	      	 f_search();
        });
       
        /**
       * @desc 展示明细信息
       * @author li.zhao
       */
       var manager = null;
       function f_open(rowdata)
       {
           manager = $.ligerDialog.open({title: '修改接口信息', height: 550,top:10, url: '${centerServer}/interface/update/'+rowdata, width: 850, showMax: true, showToggle: true,showMin: true, isResize: true, slide: true ,show :false});
       }
       function f_delete(id){
       		$.ligerDialog.confirm("确定删除接口 [ "+id+" ] ?", function (yes) { 
       			if(yes){
       				$.ligerDialog.waitting('正在删除,请稍候...');  
       				$.ajax({
				    		type: 'POST',
							url :'${centerServer}/interface/delete?t='+Math.random(),
							cache:false,
							data : {id:id},
							complete:function(){
								$.ligerDialog.closeWaitting();
							},
							success : function(data) {
								if(data.hasError){
									$.ligerDialog.error(data.message);
								}else{
									$.ligerDialog.success('删除成功!','删除接口');
									f_search();
								}
							},
							error: function(){
								$.ligerDialog.error('删除异常!','删除接口');
							}
						});
       			}
       		});
       }
       /**
       *关闭窗口
       */
       function close_open(){
       		if(manager != null){
       			f_search();
       			manager.close();
       		}
       }
        function f_deleteBatch()
        { 
            var row = grid.getSelectedRows();
            if (row.length==0) {$.ligerDialog.error('请选择行!','批量删除');  return; }
            var ids='';
            var count=0;
            for(var i=0;i<row.length;i++){
           	 count++;
            	if(count==row.length){
            		ids += row[i].id;
            	}else{
	            	ids += row[i].id+",";
            	}
            	
            }
            $.ligerDialog.confirm("确定删除接口 [ "+ids+" ] ?", function (yes) { 
       			if(yes){
       				$.ligerDialog.waitting('正在删除,请稍候...');  
       				$.ajax({
				    		type: 'POST',
							url :'${centerServer}/interface/deletebatch?t='+Math.random(),
							cache:false,
							data : {ids:ids},
							complete:function(){
								$.ligerDialog.closeWaitting();
							},
							success : function(data) {
								if(data.hasError){
									$.ligerDialog.error(data.message);
								}else{
									$.ligerDialog.success('删除成功!','删除接口');
									 f_search();
								}
							},
							error: function(){
								$.ligerDialog.error('删除异常!','删除接口');
							}
						});
       			}
       		});
        }
 </script>